<template>
  <div class="">
    <h5>{{ detail.title }}</h5>
    <div v-html="detail.content"></div>
  </div>
</template>

<script>
import { ref, reactive, toRefs } from "vue";
import { useStore } from "vuex";
import { useRouter, useRoute } from "vue-router";
import { getDetail } from "../utils/cnode";

export default {
  setup(props, ctx) {
    const store = useStore();
    const router = useRouter();
    const route = useRoute();

    const data = reactive({
      detail: {},
    });

    const id = route.params.id;
    //拿到动态路由传参传来的id
    getDetail({ id }).then((res) => {
      console.log(res);
      data.detail = res.data;
    });
    //根据id获取详情数据

    return { ...toRefs(data), id };
  },
};
</script>

<style lang="scss"></style>
